package com.cn.web.servlet;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.IOUtils;

import com.cn.domain.Product;



public class TopSaleServlet extends BaseServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		List<Product> list = ps.conditionList(new Product());
		response.setHeader("content-disposition", "attachment;filename=top.csv");
		response.setCharacterEncoding("GBK");
		for(Product p:list){
			response.getWriter().write(p.getId()+","+p.getName()+","+p.getCategory()+","+p.getPrice()+","+p.getUrl()+"\r");
		}
		
	}

}
